{% block training_data_block %}
<!-- BEGIN /ionosphere train data block -->
{% if list_by %}
  <div class="navbar-header" role="navigation">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
      <span class="sr-only">Toggle navigation</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>
			<ul class="nav nav-tabs" role="view_tablist" id="view">
			  <li class="active"><a href="/ionosphere"><span class="logo"><span class="sky">Training</span> <span class="re">data</span></span></span></a></li>
			  <li><a href="?fp_search=true&metric=all&limit=10&order=DESC"><span class="logo"><span class="sky">Features</span> <span class="re">profiles</span></span></span></a></li>
			</ul>
			<div class="tab-content">
  	  	<div class="tab-pane active" id="view">
{% endif %}

<!--
  <div class="navbar-collapse collapse">
    <ul class="nav navbar-nav">
    		<li
    		{% if url_for("ionosphere") == request.path %}
      	class="active"
      	{% endif %}
      	><a href="/ionosphere">Training data</a></li>
      	<li
      	{% if url_for("ionosphere", fp_view=true) in request.path %}
      	class="active"
      	{% endif %}
      	><a href="/ionosphere?fp_view=true">Features profiles</a></li>
    </ul>
  </div>--><!-- /.nav-collapse -->

{% if list_by %}
	<br>
<!--  <h4><span class="logo"><span class="sky">Training</span> <span class="re">data</span></span></span></h4>-->
  <div class="navbar-header" role="navigation">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
      <span class="sr-only">Toggle navigation</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>
  </div>
{% endif %}

{% if print_debug == 'True' %}
  <code> DEBUG </code></br>
  {% if requested_timestamp %}
  <code> requested_timestamp </code>: {{ requested_timestamp }}<br>
  {% else %}
  <code> requested_timestamp </code>: NOT FOUND<br>
  {% endif %}
{% endif %}

{% if display_message %}
  <code> ERROR </code></br>
  <code> message </code>: {{ display_message }}<br>
{% endif %}

{% if list_by %}
	<div class="row">
		<div class="col-md-3 col-md-push-9">
			<p>Number of training data sets in results: <strong>{{ td_files|length }}</strong></p>
			<form action="/a_500" method="get"><b>One day</b> you may be able to
			find training data sets matching a pattern:<br>
 			<input name="pattern" value="*">
			<input type="hidden" name="message" value="'You were told not to try and use the find feature, now look what happened.  Let that be a lesson to you to not try and break the rules.'" /></form><br>
			<div>but currently this <code>does not work</code> yet so <code>do not use</code> it<br></div>
			<div>The only reason it is here is to act as a reminder that it needs to be done.<br></div>
			<div>And perhaps inspire someone to try and add it.<br></div>
			<div><strike>If you think that you may be that person, please do get in touch.</strike><br></div>
			<div>Change in strategy: rather fork it and try and when it works, get in touch.<br></div>
		</div>
{% endif %}

{% if unique_metrics or metric_td_dirs %}
		<div class="col-md-9 col-md-pull-3">
			<ul class="nav nav-tabs" role="tablist" id="list_by-tabs">
  {% if list_by == 'date' or list_by == 'metric_td_dirs' %}
			  <li><a href="/ionosphere">List by metrics</a></li>
			  <li class="active"><a href="?a_dated_list=true">List by date</a></li>
  {% else %}
			  <li class="active"><a href="/ionosphere">List by metrics</a></li>
			  <li><a href="?a_dated_list=true">List by date</a></li>
  {% endif %}
			</ul>
			<div class="tab-content">
{% endif %}

{% if unique_metrics %}
  {% if list_by == 'metric' or list_by == 'timestamp_td_dirs' %}
<!-- BEGIN /ionosphere list_by 'metric' and 'timestamp_td_dirs' block -->
    {% if print_debug == 'True' %}
<code> DEBUG </code> :: /ionosphere list_by 'metric' and 'timestamp_td_dirs' block</br>
    {% endif %}
      <h3><span class="logo"><span class="sky">Ionosphere ::</span> <span class="re">usage notes :: </span></span></span> read at least once</h3>
Be aware that...<br>
And...<br>
  	  <div class="tab-pane active" id="by_metric">
        <h4><span class="logo"><span class="sky">Metrics ::</span> <span class="re">training data :: </span></span></span> {{ td_files|length }} data sets to review</h4>
  			<table class="table table-hover">
  				<thead>
  					<tr>
              <th>Metric</th>
              <th>Link to training data sets</th>
  					</tr>
  				</thead>
  				<tbody>
    {% for metric in unique_metrics %}
            <tr>
              <td><code>{{ metric }}</code></td>
              <td onclick="window.location='?metric_td={{ metric }}&requested_timestamp={{ requested_timestamp }}'">
                <a href="?metric_td={{ metric }}&requested_timestamp={{ requested_timestamp }}">{{ metric }}</a>
              </td>
            </tr>
    {% endfor %}
					</tbody>
				</table>
			</div>
  {% endif %}

  {% if list_by == 'date' or list_by == 'metric_td_dirs' %}
<!-- BEGIN /ionosphere list_by 'date' and 'metric_td_dirs' block -->
    {% if print_debug == 'True' %}
<code> DEBUG </code> :: /ionosphere list_by 'date' and 'metric_td_dirs' block</br>
    {% endif %}
  <div class="tab-pane active" id="by_date">
    <h4><span class="logo"><span class="sky">Timestamps ::</span> <span class="re">training data :: </span></span></span> {{ td_files|length }} data sets to review</h4>
		<table class="table table-hover">
			<thead>
				<tr>
          <th>Date</th>
          <th>Timestamp</th>
          <th>Link to training data sets</th>
				</tr>
			</thead>
			<tbody>
    {% for unique_ts,hdates in metric_td_dirs %}
        <tr>
      {% if unique_ts == requested_timestamp %}
          <td><code>{{ hdates }}</code></td>
          <td> {{ unique_ts }} </td>
          <td onclick="window.location='?timestamp_td={{ unique_ts }}&requested_timestamp={{ unique_ts }}'">
            <a href="?timestamp_td={{ unique_ts }}&requested_timestamp={{ unique_ts }}">{{ unique_ts }}</a>
      {% else %}
          <td>{{ hdates }}</td>
          <td> {{ unique_ts }} </td>
        {% if requested_timestamp == False %}
          <td onclick="window.location='?timestamp_td={{ unique_ts }}&requested_timestamp={{ unique_ts }}'">
            <a href="?timestamp_td={{ unique_ts }}&requested_timestamp={{ unique_ts }}">{{ unique_ts }}</a>
        {% else %}
          <td onclick="window.location='?timestamp_td={{ unique_ts }}&requested_timestamp={{ requested_timestamp }}'">
            <a href="?timestamp_td={{ unique_ts }}&requested_timestamp={{ requested_timestamp }}">{{ unique_ts }}</a>
        {% endif %}
      {% endif %}
          </td>
        </tr>
    {% endfor %}
			</tbody>
		</table>
  {% endif %}
	</div>
{% endif %}

{% if metric_td_dirs %}
  {% if list_by == 'metric_td_dirs' %}
<!-- BEGIN /ionosphere list_by 'metric_td_dirs' block -->
    {% if print_debug == 'True' %}
<code> DEBUG </code> :: /ionosphere list_by 'metric_td_dirs' block</br>
    {% endif %}

  <div class="tab-pane active" id="by_date">

      {% if print_debug == 'True' %}
        {% for unique_ts,hdates in metric_td_dirs %}
  <code> DEBUG </code> :: unique_ts :: {{ unique_ts }}</br>
  <code> requested_timestamp</code> :: {{ requested_timestamp }}<br>
  <code> hdates</code>:: {{ hdates }}</br>
  <code> unique_ts</code>:: {{ unique_ts }}</br>
        {% endfor %}
      {% endif %}
    <h4><span class="logo"><span class="sky">Training ::</span> <span class="re">data :: </span></span></span>{{ for_metric }} :: {{ td_files|length }} data sets</h4>
If you arrived here via an initial List by date route, your selected date is the <code>highlighted</code> entry
below.<br>
Please note: be advised that tracking the timestamp and metric through Flask
and Jinja templating was <b>very hard to achieve</b>.  However it was done to help <b>you</b>
as if there are multiple training data sets below and you came here by a list by
date route, it is highly probable that you would not know the date you selected
once you were presented with a multiple choice.  Please take the appropriate
amount of time to appreciate this seemingly, insignificant feature that was
<b>painstakingly</b> added for your benefit.<br>
Also note:
  	<table class="table table-hover">
  		<thead>
  			<tr>
          <th>Date</th>
          <th>Timestamp</th>
          <th>Link to training data sets</th>
  			</tr>
  		</thead>
  		<tbody>
      {% for unique_ts,hdates in metric_td_dirs %}
        <tr>
        {% if (unique_ts|string == requested_timestamp) %}
          <td><code> {{ hdates }} </code></td>
        {% else %}
          <td> {{ hdates }} </td>
        {% endif %}
          <td> {{ unique_ts }} </td>
          <td onclick="window.location='?timestamp={{ unique_ts }}&metric={{ for_metric }}&requested_timestamp={{ unique_ts }}'">
            <a href="?timestamp={{ unique_ts }}&metric={{ for_metric }}&requested_timestamp={{ unique_ts }}">{{ unique_ts }}</a>
          </td>
        </tr>
      {% endfor %}
			</tbody>
		</table>
  </div>
  {% endif %}
	</div>
{% endif %}
{% if list_by %}
	</div>
	</div>
	</div>
  </div>
  </div>
{% endif %}


{% if metric_files %}
<!-- BEGIN /ionosphere 'metric_files' block -->
    {% if print_debug == 'True' %}
<code> DEBUG </code> :: /ionosphere metric_files block</br>
    {% endif %}
<!-- # @added 20170617 - Feature #2054: ionosphere.save.training_data
# Allow the operator to save a training_data set -->
    {% if saved_metric_td == False %}
    <h4><span class="logo"><span class="sky">Training ::</span> <span class="re">data :: </span>{{ for_metric }} - {{ human_date }}</h4>
<!-- # @added 20200813 - Feature #3670: IONOSPHERE_CUSTOM_KEEP_TRAINING_TIMESERIES_FOR -->
      {% if historical_training_data == True %}
    <center><h4><span class="logo"><span class="sky"></span> <span class="re">This is HISTORICAL training data</span></span></h4></center>
      {% endif %}
    {% else %}
    <h4><span class="logo"><span class="re">SAVED - </span><span class="sky">Training ::</span> <span class="re">data :: </span>{{ for_metric }} - {{ human_date }}</h4>
    {% endif %}

		<div class="col-md-10">
  {% if data_ok == True %}
		<div class="container">
<!-- # @modified 20170122 - Feature #1876: Ionosphere - training_data learn countdown -->
    {% if print_debug == True %}
<code> DEBUG </code> :: countdown :: {{ countdown }}</br>
    {% endif %}

    {% if fp_id_created %}
      {% if fp_generation > 1 %}
		    <h4><span class="logo"><span class="sky">LEARNT ::</span> <span class="re">not anomalous :: </span></span></span>this training data has been learnt and created <b><a href="?fp_view=true&fp_id={{ fp_id_created }}&metric={{ for_metric }}">fp_id {{ fp_id_created }}</a></b></h4>
    	  <div class="alert alert-success">
    	    <strong>LEARNT</strong> this training data has been learnt and created <b><a href="?fp_view=true&fp_id={{ fp_id_created }}&metric={{ for_metric }}">fp_id {{ fp_id_created }}</a></b>
    	  </div>
      {% else %}
		    <h4><span class="logo"><span class="sky">TRAINED ::</span> <span class="re">not anomalous :: </span></span></span>trained and created <b><a href="?fp_view=true&fp_id={{ fp_id_created }}&metric={{ for_metric }}">fp_id {{ fp_id_created }}</a></b></h4>
    	  <div class="alert alert-warning">
    	    <strong>Trained</strong> this training data has already been used to create <b><a href="?fp_view=true&fp_id={{ fp_id_created }}&metric={{ for_metric }}">fp_id {{ fp_id_created }}</a></b>
    	  </div>
      {% endif %}
    {% else %}
		  <h4><span class="logo"><span class="sky">Train ::</span> <span class="re"><code>if not anomalous :: </code></span></span></span> (aka: "That's not what I call an anomaly")</h4>
    {% endif %}

    {% if saved_metric_td == False %}
      {% if countdown == False %}
		  <h4><span class="logo"><span class="sky">Countdown ::</span> <span class="re">valid to learn :: </span></span>True</h4>
      {% else %}
		  <h4><span class="logo"><span class="sky">Countdown ::</span> <span class="re">valid to learn :: </span></span>False - Ionosphere will attempt
      to learn if this is <code>not anomalous</code> from the {{ use_full_duration_days }} days features profiles that exist in:</h4>
      <div class="countdown styled"></div>
      {% endif %}
    {% endif %}

		  <h4><span class="logo"><span class="sky">Ionosphere ::</span> <span class="re">metric :: </span></span>{{ ionosphere_metric }}</h4>

<!-- # @added 20170331 - Task #1988: Review - Ionosphere layers - always show layers
# To present the operator with information as to whether an existing features
# profile has already matched a training data set -->
    {% if fp_id_matched == None %}
		  <h4><span class="logo"><span class="sky">Features profile ::</span> <span class="re">NOT matched :: </span></span>no features profiles matched this training data</h4>
    {% else %}
		  <h4><span class="logo"><span class="sky">Features profile ::</span> <span class="re">matched :: </span></span>True - <a href="?fp_view=true&fp_id={{ fp_id_matched }}&metric={{ for_metric }}">fp_id {{ fp_id_matched }}</a> has already <b><font color="green">MATCHED</font></b> this training data as <code>not anomalous</code></h4>
    {% endif %}

<!-- # @added 20170308 - Feature #1960: ionosphere_layers
# To present the operator with information as to whether an existing layer has
already matched a training data set -->
    {% if layers_id_matched == None %}
		  <h4><span class="logo"><span class="sky">Layers ::</span> <span class="re">NOT matched :: </span></span>no layers matched this training data</h4>
    {% else %}
		  <h4><span class="logo"><span class="sky">Layers ::</span> <span class="re">matched :: </span></span>True - layers_id {{ layers_id_matched }} has already <b><font color="green">MATCHED</font></b> this training data as <code>not anomalous</code></h4>
    {% endif %}

    {% if metric_training_data_saved %}
      {% if saved_metric_td == False %}
	  <div class="alert alert-success">
	    <strong>SAVED</strong> :: this training data has been saved <b><a href="?saved_training_data=true&timestamp={{ timestamp }}&metric={{ for_metric }}">{{ for_metric }} saved training page link</a></b>
	  </div>
      {% endif %}
    {% endif %}

<!-- # @modified 20170617 - Feature #2054: ionosphere.save.training_data
# Do not render the create profiles options on a saved training data page -->
    {% if saved_metric_td_requested == False %}
		  <table class="table table-hover">
		    <thead>
		      <tr>
		        <th>Training action</th>
		        <th>Info</th>
		        <th>Action</th>
		      </tr>
		    </thead>
		    <tbody>
		      <tr>
		        <td>Extract features</td>
		        <td>First extract the features from this timeseries with tsfresh, saves and displays only</td>
  {% if extracted_features %}
		        <td><b><span class="logo"><span class="sky">features ::</span> <span class="re">extracted</span></span></span></b>
						</td>
	{% else %}
		        <td><a href="?timestamp={{ timestamp }}&metric={{ for_metric }}&requested_timestamp={{ timestamp }}&calc_features=true&learn=true">
						<button type="button">Extract features</button></a> - <code>if not anomalous:</code> press this button first</td>
		      </tr>
	{% endif %}
		      <tr>
		        <td>Create features profile and <b><span class="logo"><span class="re">DO NOT</span> <span class="sky">LEARN</span></span></span> at {{ use_full_duration_days }} days</b></td>
		        <td>Then create the extracted features profile as <strong>NOT anomalous</strong>
            and <span class="logo"><span class="re">DO NOT</span> <span class="sky">LEARN</span></span></span> at {{ use_full_duration_days }} days</strong> or,</td>
  {% if extracted_features %}
    {% if not features_profile_id %}
<!--
# @added 20190922 - Ideas #2476: Label and relate anomalies
#                   Feature #2516: Add label to features profile
# Added label
		        <td><a href="?timestamp={{ timestamp }}&metric={{ for_metric }}&requested_timestamp={{ timestamp }}&add_fp=true&learn=false">
						<button type="button">Create features profile and <b>do NOT learn</b></button></a></td>
-->
		        <td>
              <form action="ionosphere">
        			<input type="hidden" name="timestamp" value="{{ timestamp }}" />
        			<input type="hidden" name="metric" value="{{ for_metric }}" />
        			<input type="hidden" name="requested_timestamp" value="{{ timestamp }}" />
        			<input type="hidden" name="add_fp" value="true" />
        			<input type="hidden" name="learn" value="false" />
        			Label: <input type="text" name="label" value="none" /> (optional)
              <input type="submit" value="Create features profile and do NOT learn">
              </form>
            </td>
    {% else %}
            <td><b><span class="logo"><span class="sky">profile ::</span> <span class="re">created</span></span></span></b>
            </td>
    {% endif %}
  {% else %}
            <td><a href="/a_500?message='You were told not to click that button, now look what happened.  Let that be a lesson to you to not try and break the rules.'&timestamp={{ timestamp }}&metric={{ for_metric }}&requested_timestamp={{ timestamp }}&add_features_profile=true">
            <button type="button" onclick="return confirm('Are you sure you want to try and click the Create features profile button before you have extracted the features? Especially after being advise to not do it?');">Create features profile and <b>DO NOT learn</b></button></a><br>
            You first have to extract features before this button will work properly.<br>
  {% endif %}
<!--
# @added 20170119 - Feature #1854: Ionosphere learn - generations
# Allow for a features profile to NOT be learnt at use_full_duration_days this
# allows a not anomalous timeseries at full_duration to have a features profile
# created for it but the user 30 day or use_full_duration_days timeseries may
# not want to add that to be learnt.
-->
		      <tr>
		        <td>Create features profile and <b><span class="logo"><span class="re">DO</span> <span class="sky">LEARN</span></span></span> at {{ use_full_duration_days }} days</b></td>
		        <td>Or create a features profile as <strong>NOT anomalous</strong>
            and <span class="logo"><span class="re">DO</span> <span class="sky">LEARN</span></span></span> at {{ use_full_duration_days }} days</strong></td>
    {% if not features_profile_id %}
      {% if extracted_features %}
<!--
# @added 20190922 - Feature #2516: Add label to features profile
# Added label
		        <td><a href="?timestamp={{ timestamp }}&metric={{ for_metric }}&requested_timestamp={{ timestamp }}&add_fp=true&learn=true">
						<button type="button">Create features profile and <b>LEARN</b></button></a></td>
-->
		        <td>
              <form action="ionosphere">
        			<input type="hidden" name="timestamp" value="{{ timestamp }}" />
        			<input type="hidden" name="metric" value="{{ for_metric }}" />
        			<input type="hidden" name="requested_timestamp" value="{{ timestamp }}" />
        			<input type="hidden" name="add_fp" value="true" />
        			<input type="hidden" name="learn" value="true" />
        			Label: <input type="text" name="label" value="none" /> (optional)
              <input type="submit" value="Create features profile and LEARN">
              </form>
            </td>
      {% else %}
            <td><a href="/a_500?message='You were told not to click that button, now look what happened.  Let that be a lesson to you to not try and break the rules.'&timestamp={{ timestamp }}&metric={{ for_metric }}&requested_timestamp={{ timestamp }}&add_features_profile=true">
            <button type="button" onclick="return confirm('Are you sure you want to try and click the Create features profile button before you have extracted the features? Especially after being advise to not do it?');">Create features profile and <b>LEARN</b></button></a><br>
            You first have to extract features before this button will work properly.<br></td>
      {% endif %}
    {% else %}
            <td>
      {% if learn %}
            <b><span class="logo"><span class="sky">profile ::</span> <span class="re">created and learning</span></span></span></b>
      {% else %}
            <b><span class="logo"><span class="sky">profile ::</span> <span class="re">created and NOT learning</span></span></span></b>
      {% endif %}
            </td>
	 {% endif %}
		      </tr>
		    </tbody>
		  </table>
    {% else %}
          <h4><b><span class="logo"><span class="sky">SAVED ::</span> <span class="re">training data</span></span></span></b></h4>
      {% if saved_metric_td_details %}
          <pre>{{ saved_metric_td_details }}</pre>
      {% endif %}
    {% endif %}

<!-- # @added 20171106 - Feature #2210: existing features profiles link
Add a link to features profiles for a metric so that the operator can open up
the features profile search page with all the features profiles for the metric
to evaluate efficiency and count of features profiles to determine how effectively
Ionosphere is working on a metric.  This could be a table insert like Existing
layers, but big tables may hinder easy navigation in the training page, so a
link and new tab is ok.
-->
	  <h4><span class="logo"><span class="sky">Existing ::</span> <span class="re">features profiles page link ::</span></span></span> <a href="?fp_search=true&metric={{ for_metric}}&limit=0&order=DESC" target="_blank">existing features profile page for {{ for_metric }}</a></h4>
<!-- # @added 20180918 - Feature #2602: Graphs in search_features_profiles -->
	  <h5><span class="logo"><span class="sky">Existing ::</span> <span class="re">features profiles page link with graphs ::</span></span></span> <a href="?fp_search=true&metric={{ for_metric}}&limit=0&order=DESC&show_graphs=true" target="_blank">existing features profile page with graphs for {{ for_metric }}</a></h5>

<!-- # @added 20170308 - Feature #1960: ionosphere_layers
# To present the operator with the existing layers and algorithms for the metric
# @modified 20170331 - Task #1988: Review - Ionosphere layers - always show layers
# Moved the layer table block so that they are always displayed where relevant -->
  {% if not layers_id_matched %}
      {% include "layers_table.html" %}
  {% endif %}

  {% if extracted_features %}
	  <h4><span class="logo"><span class="sky">Extracted ::</span> <span class="re">features ::</span></span></span> created OK</h4>
		<pre>{{ extracted_features }}</pre>
    {% if not features_profile_id %}
	  <div class="alert alert-success">
	    <strong>Success!</strong> Features were extracted from the timeseries with tsfresh-{{ tsfresh_version }} in {{ calc_time }} seconds
	  </div>
	  <div class="alert alert-warning">
	    <strong>Warning!</strong> Features have only been calculated.<strong> A features
profile has not been created yet</strong> to train Skyline with, use the <strong>Create features profile</strong>
button above to train Skyline on this features profile for {{ for_metric }} <code>if not anomalous:</code>
	  </div>
	  <div class="alert alert-danger">
	    <strong>Danger!</strong> If you leave this page before clicking the
<strong>Create features profile</strong> button above to train Skyline
<strong>AND</strong> you think that this is <strong>NOT anomalous</strong>,
all the energy that was used to calculate the features might be wasted.  Which would be a
shame if you thought it was not anomalous. And further, just think of all the
email alerts it might save yourself from having to delete in the future as well.
But only the click it if you are really sure that you think it is not anomalous.
But if you wait too long Ionosphere might remove it, so try and act decisively.
	  </div>
    {% endif %}
  {% endif %}

  {% if features_profile_id %}
	  <h4><span class="logo"><span class="sky">Features ::</span> <span class="re">profile ::</span></span></span> id {{ features_profile_id }} created OK</h4>
    {% if not features_profile_exists %}
	  <div class="alert alert-success">
	    <strong>Success!</strong> The features profile was created with id {{ features_profile_id }}
      and can be viewed in the Features Profiles <a href="?fp_view=true&timestamp={{ timestamp }}&metric={{ for_metric}}">features profile page for fp_id {{ features_profile_id }}</a>
      or view under the {{ for_metric }} and {{ timestamp }}  dir in ionosphere/features_profiles/.
	  </div>
    {% else %}
	  <div class="alert alert-warning">
	    <strong>A features profile has already been created or learnt</strong> from this training data set with fp_id {{ features_profile_id }}.
      This training data set will be removed by the normal Ionosphere training data roomba that removes old training data dirs and files.
      <strong>However it is good to know</strong> that you thought this was not anomalous <strong>as well or again :)</strong>.  This training data set is now a features_profiles
      data set and can be viewed via this link in the Features Profiles <a href="?fp_view=true&timestamp={{ timestamp }}&metric={{ for_metric }}"><strong>features profile page for fp_id {{ features_profile_id }}</strong></a>
	  </div>
    {% endif %}

	  <h3><span class="logo"><span class="sky">Trained ::</span> <span class="re">profile :: </span></span></span>{{ for_metric }}</h3>

  {% endif %}


<!-- @added 20170303 - Feature #1960: ionosphere_layers -->
  {% if features_profile_id %}
    {% if layer_id %}
	  <h3><span class="logo"><span class="sky">Trained ::</span> <span class="re">layers :: </span></span></span>{{ for_metric }}</h3>
      {% if layers_algorithms_ids %}
  	  <div class="alert alert-success">
  	    <strong>Success!</strong> The features profile layers were created with id {{ layer_id }}<br>
        Layers created :: {{ layers_algorithms }}<br>
        Layers algorithm id :: {{ layers_algorithms_ids }}<br>
  	  </div>
      {% else %}
  	  <div class="alert alert-warning">
  	    <strong>The features profile layers have already been created for this profile layers id {{ layer_id }}.</strong>
  	  </div>
      {% endif %}
    {% else %}
	  <h3><span class="logo"><span class="sky">Train ::</span> <span class="re">layers :: </span></span></span>[optional] - {{ for_metric }}</h3>
Optionally you now can create an Ionosphere layers profile which allows you to specify conditions that are <code>not anomalous</code> at <b>FULL_DURATION</b>.<br>
This does not stop Skyline learning, it reduces Ionosphere alerts and enables the creation of custom Boundary type algorithms per metric and profile<br>
For Ionosphere to determine that the timeseries is <code>not anomalous</code> <b>every enabled</b> layer must be matched (or not matched in terms of layers D and D1).

<!-- # @added 20170331 - Task #1988: Review - Ionosphere layers - always show layers
# Added the Redis data plot here to present the operator with the max, min,
# mean, and 3sigma limits can be evaluted and inform to aid in the layers
# creation and remind them that layer operate in the FULL_DURATION scope/
# To present the operator with the existing layers and algorithms for the metric -->
      {% for image in metric_images %}
        {% if '.redis.plot' in image %}
      <img src="ionosphere_images?image={{ image }}" alt="{{ for_metric }} timeseries graph" class="img-responsive center-block" /><br>
        {% endif %}
      {% endfor %}

      <form action="ionosphere">
			<input type="hidden" name="timestamp" value="{{ timestamp }}" />
			<input type="hidden" name="metric" value="{{ for_metric }}" />
    {% if requested_timestamp %}
			<input type="hidden" name="requested_timestamp" value="{{ requested_timestamp }}" />
    {% endif %}
    {% if add_fp %}
			<input type="hidden" name="add_fp" value="{{ add_fp }}" />
    {% endif %}
    {% if learn %}
			<input type="hidden" name="learn" value="{{ learn }}" />
    {% endif %}
		  <table class="table table-hover">
		    <thead>
		      <tr>
		        <th>Layer</th>
		        <th>Criteria</th>
		      </tr>
		    </thead>
		    <tbody>
		      <tr>
		        <td>D layer <code>[required]</code></td>
		        <td>if value <select name="d_condition">
<!-- @modified 20180820 - Task #2446: Optimize Ionosphere
#                         Feature #2464: luminosity_remote_data
# Changed from > to less intiutive but normal more accurate >= which is mostly
# used in this layer.
-->
              <option value=">=">>=</option>
            {% for item in value_condition_list %}
                  <option value="{{ item }}">{{ item }}</option>
            {% endfor %}
<!-- @modified 20170317 - Feature #1960: ionosphere_layers - allow for floats
              <input type="number" name="d_boundary_limit" value="0" /> in the last-->
  		        <input type="text" name="d_boundary_limit" value="0" /> in the last
              <select name="d_boundary_times">
              <option value="1">1</option></select> values in the timeseries - <code>DISCARD - not_anomalous</code> False<br>
            The D layer can be used as the upper or lower limit, e.g if value > x (probably or certainly anomalous)<br>
            Or this can be used if this metric operates in the negative range or<br>
            if you want it too not discard on 0 as you want to match 0, set it to -1 or > 0.1 or > 1<br>
            On a high constant rate metric the D layer can be used to discard if < x so the the layer <b>does not silence a drop</b><br>
            This layer can be complimented by the optional D1 layer below<br>
            <code>Remember a match here disables any of the other below layers being checked</code><br>
            </td>
		      </tr>
<!-- @added 20170616 - Feature #2048: D1 ionosphere layer -->
		      <tr>
		        <td>D1 layer <code>[optional]</code></td>
		        <td>if value <select name="d1_condition">
              <option value="none">none</option>
            {% for item in value_condition_list %}
                  <option value="{{ item }}">{{ item }}</option>
            {% endfor %}
  		        <input type="text" name="d1_boundary_limit" value="0" /> in the last
              <input type="number" name="d1_boundary_times" value="1" /> values in the timeseries - <code>DISCARD - not_anomalous</code> False<br>
            The D1 layer can be used as an upper or lower limit, so the D layer <b>does not silence a drop</b><br>
            <code>Remember a match here disables any of the other below layer conditions from being checked</code><br>
            </td>
		      </tr>
		      <tr>
		        <td>E layer <code>[required]</code></td>
		        <td>if value <select name="e_condition">
<!-- @modified 20180820 - Task #2446: Optimize Ionosphere
#                         Feature #2464: luminosity_remote_data
# Changed from == to less intiutive but normal more accurate <= which is mostly
# used in this layer.
-->
              <option value="<="><=</option>
            {% for item in value_condition_list %}
                  <option value="{{ item }}">{{ item }}</option>
            {% endfor %}
<!-- @modified 20170317 - Feature #1960: ionosphere_layers - allow for floats
              <input type="number" name="e_boundary_limit" value="0" /> in the last-->
  		        <input type="text" name="e_boundary_limit" value="0" /> in the last
              <input type="number" name="e_boundary_times" value="3" /> values in the timeseries - <code>not_anomalous</code> True
            </select></td>
		      </tr>
		      <tr>
		        <td>Es layer <code>[optional]</code><br>
            This layer allows to match a day in a list<br>
            <code>NOT IMPLEMENTED YET</code>
            </td>
		        <td>Enabled: <select name="es_layer">
              <option value="false">false</option>
              </select>
		          if day in <input type="text" name="es_day" value="['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']" /> - <code>not_anomalous</code><br>
              A Python list - example <code>['tue']</code> or <code>['sat', 'sun']</code><br>
              <code>NOT IMPLEMENTED YET</code>
            </td>
		      </tr>
		      <tr>
		        <td>F1 layer <code>[optional]</code><br>
              This layer and the F2 layer<br>
              allow for excluding a time period<br>
              <code>NOT IMPLEMENTED YET</code>
            </td>
		        <td>Enabled: <select name="f1_layer">
              <option value="false">false</option>
              </select>
              if from_time > <input type="text" name="f1_from_time" value="0000" /> (format HHMM) - <code>not_anomalous</code><br>
              <code>NOT IMPLEMENTED YET</code>
            </td>
		      </tr>
		      <tr>
		        <td>F2 layer <code>[optional]</code><br>
              <code>NOT IMPLEMENTED YET</code></td>
		        <td>Enabled: <select name="f1_layer">
              <option value="false">false</option>
              </select>
              if until_time < <input type="text" name="f2_until_time" value="2359" /> (format HHMM) - <code>not_anomalous</code><br>
              <code>NOT IMPLEMENTED YET</code>
            </td>
		      </tr>
		      <tr>
		        <td>Create layers</td>
		        <td><select name="fp_layer">
              <option value="true">true</option>
              </select>
              for fp_id <select name="fp_id"><option value="{{ features_profile_id }}">{{ features_profile_id }}</option></select><br>
			        Label: <input type="text" name="fp_layer_label" value="none" /> - optional label, e.g. gt_10-4_in_3 or tuesday_pentest
			        <input type="hidden" name="add_fp_layer" value="true" />
              <input type="submit" value="Create Ionosphere layers">
              </form>
            </td>
		      </tr>
		    </tbody>
		  </table>

<!-- # @added 20170331 - Task #1988: Review - Ionosphere layers - always show layers
# Moved the layer table block so that they are always displayed where relevant -->
      {% include "layers_table.html" %}
    {% if last_i_ts_json %}
	  <h4><span class="logo"><span class="sky">Last ::</span> <span class="re">30 datapoints ::</span></span></span> at FULL_DURATION of ({{ redis_full_duration }}) for evalution in layers creation</h4>
    {{ last_i_ts_json }}
    {% endif %}

    {% endif %}
  {% endif %}

<!-- # @added 20170308 - Feature #1960: ionosphere_layers
# To present the operator with the existing layers and algorithms for the metric
# @modified 20170331 - Task #1988: Review - Ionosphere layers - always show layers
# Moved the layer table block so that they are always displayed where relevant -->
  {% if layers_id_matched %}
      {% include "layers_table.html" %}
      {% if last_i_ts_json %}
  	  <h4><span class="logo"><span class="sky">Last ::</span> <span class="re">30 datapoints ::</span></span></span> at FULL_DURATION of ({{ redis_full_duration }}) for evalution of the training data timeseries that <strong>layers id {{ layers_id_matched }} <font color="green">MATCHED</font></strong></h4>
      {{ last_i_ts_json }}
      {% endif %}
  {% endif %}

  {% endif %}

  {% if data_ok == False %}
  <h3><span class="logo"><span class="sky">Holy ::</span> <span class="re">shit</span></span></span></h3>
  <h4><span class="logo"><span class="sky">Skyline ::</span> <span class="re">error</span></span></span></h4>

  <b><span class="logo"><span class="sky">Skyline ::</span> <span class="re">error message</span></span></span></b>
The timeseries data for this anomaly was not loaded, either an error occurred or
the data is gone or corrupt.  Please try reload the page <strong>quicker</strong>
next time.<br>
<b><span class="logo"><span class="sky">Skyline ::</span> <span class="re">advice :: </span></span></b>
<ol type="1">
  <li>Try be quicker next time</li>
  <li>You can see if it is listed in the files section below and if it is
	not there then maybe some Gremlins are in the data centre or you might need to
	speak to management about the seemingly shoddy quality of the disks or resources
	that you administrator/s are providing for this very important service.
	</li>
	<li>This could be indicative of the IMMINENT failure of the server running
	this important Skyline service, it should not be corrupting or losing simple
	json text files, this is really unacceptable and you should consider writing
	a stern letter of complaint to your service provider.  If you are your own
	service provider, perhaps it is time you found a new service provider.</li>
</ol>
<b><span class="logo"><span class="sky">Skyline ::</span> <span class="re">apologies ::</span></span></b> below in the Danger alert<br>
	  <div class="alert alert-danger">
<strong>Danger! Oh dear.</strong> <b><span class="logo"><span class="sky">Skyline ::</span> <span class="re">apologies ::</span></span></b>
 profusely it seems that the timeseries json data for {{ for_metric }} at {{ timestamp }} | {{ human_date }}
has gone!!!  Perhaps it was removed before you could click the mouse. Maybe
you need to try and be quicker next time.
	  </div>

  {% endif %}
<!-- # @modified 20190510 - Feature #2990: Add metrics id to relevant Ionosphere pages
# Added the metric id -->
      <h4><span class="logo"><span class="sky">Details ::</span> <span class="re">anomaly ::</span></span></span> {{ for_metric }} with metrics id {{ metric_id }}</h4>
      {{ metric_vars }}<br>
  {% if panorama_anomaly_id != False %}
      <h4><span class="logo"><span class="sky">Panorama ::</span> <span class="re">anomaly ::</span></span></span> id {{ panorama_anomaly_id }}</h4>
  {% elif panorama_anomaly_id == 'None' %}
      <h4><span class="logo"><span class="sky">Panorama ::</span> <span class="re">anomaly ::</span></span></span> id {{ panorama_anomaly_id }}</h4>
{{ for_metric }} has no Panorama anomaly recorded at this timestamp
  {% else %}
      <h4><span class="logo"><span class="sky">Panorama ::</span> <span class="re">anomaly ::</span></span></span> id {{ panorama_anomaly_id }}</h4>
  {% endif %}
  {% if panorama_anomaly_id == None %}
    {% if layers_id_matched %}
	  <div class="alert alert-success">
	    <strong>layers id {{ layers_id_matched }} <font color="green">MATCHED</font></strong> therefore there is no Panorama recorded anomaly as this is a training data set only and was <code>not anomalous</code>
	  </div>
    {% elif fp_id_matched %}
	  <div class="alert alert-success">
	    <strong><a href="?fp_view=true&fp_id={{ fp_id_matched }}&metric={{ for_metric }}">fp_id {{ fp_id_matched }}</a> <font color="green">MATCHED</font></strong> therefore there is no Panorama recorded anomaly as this is a training data set only and was <code>not anomalous</code>
	  </div>
    {% else %}
	  <div class="alert alert-warning">
<strong>Please note :: </strong> it seems that {{ for_metric }} has no Panorama anomaly recorded at
this timestamp, this can happen when a Panorama expiry key has not yet expired
and a metric is checking and found anomalous a number of times in a row.
	  </div>
    {% endif %}
  {% endif %}

<!-- # @added 20200808 - Feature #3568: Ionosphere - report anomalies in training period -->
    {% if labelled_anomalies == None %}
		  <h4><span class="logo"><span class="sky">Labelled ::</span> <span class="re">anomalies :: </span></span>no labelled anomalies were found in the training period</h4>
    {% else %}
		  <h4><span class="logo"><span class="sky">Labelled ::</span> <span class="re">anomalies :: </span></span>labelled anomalies were found in the training period</h4>
			<table class="table table-hover">
				<thead>
					<tr>
<!-- [id, timestamp, label] -->
            <th>id</th>
            <th>created_timestamp</th>
            <th>timestamp</th>
            <th>label</th>
					</tr>
				</thead>
				<tbody>
    {% for item in labelled_anomalies %}
          <tr>
            <td>{{ item[0] }}</td>
            <td>{{ item[1] }}</td>
            <td>{{ item[2] }}</td>
            <td>{{ item[3] }}</td>
          </tr>
    {% endfor %}
				</tbody>
			</table>
    {% endif %}

  {% for image in metric_images %}
<!-- # @modified 20210323 - Feature #3642: Anomaly type classification -->
    {% if (( not '.redis.plot' in image) and ( not '.matplotlib' in image) and ( not 'luminosity.classify_anomaly' in image )) %}
      {% if metric_second_order_resolution_hours != False %}
      <h4><span class="logo"><span class="sky">Graphite ::</span> <span class="re">anomaly ::</span></span></span> graph at <strong>{{ metric_second_order_resolution_hours }} hours</strong></h4>
      {% else %}
      <h4><span class="logo"><span class="sky">Graphite ::</span> <span class="re">anomaly ::</span></span></span> graph at <strong>{{ metric_full_duration_in_hours }} hours</strong></h4>
      {% endif %}
      {% if graphite_url != False %}
If you wish to see the <a target='_blank' href="{{ graphite_url }}">current
Graphite graph</a> for {{ for_metric }} (opens in new tab)
      {% endif %}
      <img src="ionosphere_images?image={{ image }}" alt="{{ for_metric }} timeseries graph" class="img-responsive center-block" /><br>
Image file: {{ image }}<br><br>
    {% endif %}
  {% endfor %}

  {% if fp_id_matched %}
    <h4><span class="logo"><span class="sky">Graphite ::</span> <span class="re">anomaly ::</span></span></span> no graph as <strong><a href="?fp_view=true&fp_id={{ fp_id_matched }}&metric={{ for_metric }}">fp_id {{ fp_id_matched }}</a> <font color="green">MATCHED</font></strong></h4>
	  <div class="alert alert-success">
	    <strong><a href="?fp_view=true&fp_id={{ fp_id_matched }}&metric={{ for_metric }}">fp_id {{ fp_id_matched }}</a></strong> therefore no Graphite image was generated because no alert was sent as this is a training data set only and was <code>not anomalous</code>
	  </div>
  {% endif %}
  {% if layers_id_matched %}
    <h4><span class="logo"><span class="sky">Graphite ::</span> <span class="re">anomaly ::</span></span></span> no graph as <strong>layers id {{ layers_id_matched }} <font color="green">MATCHED</font></strong></h4>
	  <div class="alert alert-success">
	    <strong>layers id {{ layers_id_matched }} <font color="green">MATCHED</font></strong> therefore no Graphite image was generated because no alert was sent as this is a training data set only and was <code>not anomalous</code>
	  </div>
  {% endif %}

  {% if fp_id_matched %}
      <h4><span class="logo"><span class="sky">Graphite ::</span> <span class="re">graphs {{ graphite_now_graphs_title }} ::</span></span></span> at <strong>7h, 24h, 7d and 30d</strong> for anomaly at <strong>{{ human_date }}</strong> when <strong><a href="?fp_view=true&fp_id={{ fp_id_matched }}&metric={{ for_metric }}">fp_id {{ fp_id_matched }}</a> <font color="green">MATCHED</font></strong></h4>
  {% elif layers_id_matched %}
      <h4><span class="logo"><span class="sky">Graphite ::</span> <span class="re">graphs {{ graphite_now_graphs_title }} ::</span></span></span> at <strong>7h, 24h, 7d and 30d</strong> for anomaly at <strong>{{ human_date }}</strong> when <strong>layers id {{ layers_id_matched }} <font color="green">MATCHED</font></strong></h4>
  {% elif saved_metric_td_requested %}
      <h4><span class="logo"><span class="sky">Graphite ::</span> <span class="re">graphs when saved as {{ graphite_now_graphs_title }} ::</span></span></span> at <strong>7h, 24h, 7d and 30d</strong> for anomaly at <strong>{{ human_date }}</strong></h4>
  {% else %}
      <h4><span class="logo"><span class="sky">Graphite ::</span> <span class="re">graphs {{ graphite_now_graphs_title }} ::</span></span></span> at <strong>7h, 24h, 7d and 30d</strong> for anomaly at <strong>{{ human_date }}</strong></h4>
  {% endif %}
<!-- @added 20170106 - Feature #1842: Ionosphere - Graphite now graphs -->
  {% for gimage in graphite_now_images %}
<!--      <img src="ionosphere_images?image={{ gimage }}" alt="{{ for_metric }} timeseries graph" class="img-responsive center-block" />
# Align 4 images - tried all of http://stackoverflow.com/questions/9382970/how-to-center-a-div-with-bootstrap2
# end up using https://owlcation.com/stem/how-to-align-images-side-by-side thanks
# Ellen Brundige
-->
        <img src="ionosphere_images?image={{ gimage }}" alt="{{ for_metric }} timeseries graph" style="float: left; width: 40%; margin-right: 1%; margin-bottom: 0.5em;">
  {% endfor %}
        <p style="clear: both;">

<!-- # @added 20180804 - Feature #2488: Allow user to specifically set metric as a derivative metric in training_data -->
  {% if graphite_now_images %}
	  <div class="alert alert-danger">
    If the Graphite graphs are not displaying as derivatives you can reload them and set the metric
    as having strictly increasing monotonicity - see <a href="/static/docs/monotonic-metrics.html#">docs</a>
      <a href="?timestamp={{ timestamp }}&metric={{ for_metric }}&load_derivative_graphs=true">
      <button type="button" onclick="return confirm('Are you sure you want to set this metric to strictly increasing monotonicity?');"><b>Load derivative graphs</b></button></a>
	  </div>
  {% endif %}

  {% for image in metric_images %}
    {% if '.redis.plot' in image %}
      <h4><span class="logo"><span class="sky">Redis ::</span> <span class="re">anomaly ::</span></span></span> data plot at <strong>{{ redis_full_duration_in_hours }} hours</strong></h4>
      <img src="ionosphere_images?image={{ image }}" alt="{{ for_metric }} timeseries graph" class="img-responsive center-block" /><br>
Image file: {{ image }}<br><br>

<!-- # @added 20170331 - Task #1988: Review - Ionosphere layers - always show layers
# Show below Redis plot some they can be evaluted visually against the Redis
# FULL_DURATION data -->
    {% include "layers_table.html" %}

    {% endif %}
  {% endfor %}

  {% if fp_id_matched %}
    <h4><span class="logo"><span class="sky">Redis ::</span> <span class="re">anomaly ::</span></span></span> no data plot at <strong>{{ redis_full_duration_in_hours }} hours</strong></h4>
	  <div class="alert alert-success">
	    <strong><a href="?fp_view=true&fp_id={{ fp_id_matched }}&metric={{ for_metric }}">fp_id {{ fp_id_matched }}</a> <font color="green">MATCHED</font></strong> therefore no Redis plot was generated because no alert was sent as this is a training data set only and was <code>not anomalous</code>
	  </div>
  {% endif %}
  {% if layers_id_matched %}
    <h4><span class="logo"><span class="sky">Redis ::</span> <span class="re">anomaly ::</span></span></span> no data plot at <strong>{{ redis_full_duration_in_hours }} hours</strong></h4>
	  <div class="alert alert-success">
	    <strong>layers id {{ layers_id_matched }} <font color="green">MATCHED</font></strong> therefore no Redis plot was generated because no alert was sent as this is a training data set only and was <code>not anomalous</code>
	  </div>
  {% endif %}

<!-- # @added 20180803 - Feature #2482: last 30 data points on training_data page
# Display the last 30 data points on the training_data page to inform the
# operator of the Redis graph data points for comparison with any
# Existing :: layers -->
  {% if last_i_ts_json %}
	  <h4><span class="logo"><span class="sky">Last ::</span> <span class="re">30 datapoints ::</span></span></span> at FULL_DURATION of ({{ redis_full_duration }}) for reviewing the Redis data graph and comparing to any existing layers</h4>
    {{ last_i_ts_json }}
  {% endif %}

<!-- # @added 20180414 - Branch #2270: luminosity -->
  {% if panorama_anomaly_id %}
    {% include "correlations.html" %}
  {% endif %}

<!-- # @added 20210324 - Feature #3642: Anomaly type classification -->
  {% if anomaly_types %}
  <h4><span class="logo"><span class="sky">Luminosity ::</span> <span class="re">classify_anomaly ::</span></span> types</h4>
    {{ anomaly_types }}
  {% endif %}

<!-- # @added 20210323 - Feature #3642: Anomaly type classification -->
  {% if 'luminosity.classify_anomaly' in metric_images_str %}
    {% if metric_second_order_resolution_hours != False %}
  <h4><span class="logo"><span class="sky">Luminosity ::</span> <span class="re">classify_anomaly ::</span></span> graphs at <strong>{{ metric_second_order_resolution_hours }} hours</strong></h4>
    {% else %}
  <h4><span class="logo"><span class="sky">Luminosity ::</span> <span class="re">classify_anomaly ::</span> graphs at <strong>{{ metric_full_duration_in_hours }} hours</strong></h4>
    {% endif %}
    {% for image in metric_images %}
      {% if 'luminosity.classify_anomaly' in image %}
      <img src="ionosphere_images?image={{ image }}" alt="{{ for_metric }} timeseries graph" class="img-responsive center-block" /><br>
Image file: {{ image }}<br><br>
      {% endif %}
    {% endfor %}
  {% endif %}


    <h4><span class="logo"><span class="sky">Training ::</span> <span class="re">data ::</span></span></span> files</h4>
      <table>
        <tr>
          <th>[filename, path_and_filename]</th>
        </tr>
  {% for file in metric_files %}
        <tr>
          <td> {{ file }} </td>
          <td onclick="window.location='?metric_td={{ metric }}'">
            <a href="?metric_td={{ metric }}">{{ metric }}</a>
          </td>
        </tr>
  {% endfor %}
      </table>
  {% if data_ok == True %}
      <br><p>
<!-- # @modified 20170309 - Feature #1960: ionosphere_layers
    <h4><span class="logo"><span class="sky">Time series ::</span> <span class="re">not anomalous ::</span></span></span> <span class="sky">available</span></h4>
      {{ timeseries[-30:] }}-->
<!-- # @modified 20200711 - Feature #3634: webapp - ionosphere - report number of data points
     # Added length -->
    <h4><span class="logo"><span class="sky">Time series ::</span> <span class="re">anomalous ::</span></span></span> <span class="sky">json available [['app', '{{ app_context }}'], ['full_duration', {{ ts_full_duration }}]] - last 30 data points of {{ anomalous_timeseries_length }}</span></h4>
      {{ last_ts_json[-30:] }}
<!-- # @added 20170309 - Feature #1960: ionosphere_layers
Also return the Analyzer FULL_DURATION timeseries if available in a Mirage
based features profile -->
    {% if ionosphere_json %}
<!-- # @modified 20200711 - Feature #3634: webapp - ionosphere - report number of data points
     # Added length -->
    <h4><span class="logo"><span class="sky">Time series ::</span> <span class="re">anomalous ::</span></span></span> <span class="sky">json available [['app', 'Analyzer'], ['full_duration', {{ baseline_fd }}]] - last 30 data points of {{ ts_json_length }}</span></h4>
<!--      {{ ionosphere_json[-30:] }} -->
      {{ last_i_ts_json[-30:] }}
    {% endif %}
  {% endif %}

<!-- # @added 20170331 - Task #1988: Review - Ionosphere layers - always show layers
# Present the operator with the existing layers and algorithms for the metric in
# where relevant to assist with assessment and decision making -->
  {% include "layers_table.html" %}

<!-- # @added 20170617 - Feature #2054: ionosphere.save.training_data
# Allow the operator to save a training_data set -->
    {% if saved_metric_td == False %}
      <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#save_training_data">Save training data</button>
      <code>NOTE: - this should only be used for debugging, testing or sharing a training data set for demo or training.  It
      is not generally required.</code>

  		<div class="col-md-12">
        <div id="save_training_data" class="collapse">
          <form action="ionosphere">
    		  <table class="table table-hover">
    		    <thead>
    		      <tr>
    		        <th>Action</th>
    		        <th>Input</th>
    		      </tr>
    		    </thead>
    		    <tbody>
    		      <tr>
    		        <td>Save training data</td>
    		        <td><select name="save_training_data">
                  <option value="true">true</option>
                  </select>
    			        Label: <input type="text" name="saved_td_label" value="label" /> - optional label, e.g. iowait increase
    			        <input type="hidden" name="timestamp" value="{{ timestamp }}" />
    			        <input type="hidden" name="metric" value="{{ for_metric }}" />
                  <input type="submit" value="Save training data">
                  </form>
                </td>
    		      </tr>
    		    </tbody>
    		  </table>
        </div>
      </div>
      {% if metric_training_data_saved %}
  	  <div class="alert alert-success">
  	    <strong>SAVED</strong> :: this training data has been saved <b><a href="?saved_training_data=true&timestamp={{ timestamp }}&metric={{ for_metric }}">saved for {{ for_metric }}</a></b>
  	  </div>
      {% endif %}
    {% endif %}

    </div>
  </div>

  <div class="known_bugs">
    <table>
        <caption><b><span class="logo"><span class="sky">Known</span> <span class="re">bugs</span></span></b></caption>
        <tr>
<!-- @modified 20170106 - Feature #1830: Ionosphere alerts
#                         Bug #1460: panorama check file fails
#                         Panorama check file fails #24
# Fixed
            <td>
              <a target='_blank' href="https://github.com/earthgecko/skyline/issues/24">#24</a>
            </td>
            <td>An anomaly can sometimes not have a matching Panorama anomaly record due to Panorama check file fails #24</td>
-->
<!-- @modified 20180717 - Bug #2450: Ionosphere learn countdown clock at 0 when client and server timezone differs
            <td>None</td>
            <td>That are known of at the present time</td>
 -->
            <td>
              <a target='_blank' href="https://github.com/earthgecko/skyline/issues/52">#52</a>
            </td>
            <td>The countdown clock is 00:00:00 when client and server timezone differs for the duration of the Ionosphere learn period</td>
        </tr>
    </table>
  </div>

{% endif %}


<!-- END /ionosphere block -->
{% endblock %}
